import Vue from 'vue'
import App from './App.vue'
import router from './router'
import store from './store'
import config from "./config/config";
import ElementUI from 'element-ui';
import 'element-ui/lib/theme-chalk/index.css';
import './assets/gloable.css'
import request from "@/utils/request";
import mavonEditor from 'mavon-editor'
import 'mavon-editor/dist/css/index.css'
// 计算响应式
import 'lib-flexible-computer'
import 'element-ui/lib/theme-chalk/display.css';
import axios from "axios";

// import  "lib-flexible/flexible"
// use
// var url="http://192.168.100.12:8088"
Vue.use(mavonEditor)
// axios.defaults.baseURL = '/api'
Vue.config.productionTip = false
// Vue.use(api)
Vue.use(ElementUI, { size: "small" });
Vue.filter('dateFormat', function (originVal) {
  // const val = JSON.parse(originVal)
  // Date(parseInt(value))
  const dt = new Date(originVal)
  // const dt = new  Date(parseInt(originVal))
  // if(dt !== 'Invalid Date'){
    const y = dt.getFullYear()
    const m = (dt.getMonth() + 1 + '').padStart(2,'0')
    const d = (dt.getDate() + '').padStart(2, '0')
    const hh = (dt.getHours() + '').padStart(2,'0')
    const mm = (dt.getMinutes() + '').padStart(2,'0')
    const ss = (dt.getSeconds() + '').padStart(2, '0')

    // return `${y}-${m}-${d}  ${hh}:${mm}:${ss}`
    return `${y}-${m}-${d}`
  // }else{
  //   return originVal
  // }
})
Vue.prototype.request=request
new Vue({
  router,
  store,
  render: h => h(App),
  mounted : function() {
    //可用于设置自适应屏幕，根据获得的可视宽度（兼容性）判断是否显示
    let w = document.documentElement.offsetWidth || document.body.offsetWidth;
    if (w < 1000) {
      this.show = false;
    }
  }
}).$mount('#app')
